<?php
class editAction extends rareAction{
	public function execute(){
		$id = $this->getGetParam('id',0);
		if($id == 0) forward('links/index');
		$linksDao = new DaoLinks();
		$linksDao = $linksDao->getOne(" id = '$id'");
		$this->assign('links',$linksDao);
	}
	public function executePost(){
		$links = $this->getPostParam('links',array());
		$id = $this->getPostParam('id',0);
		$images = $this->getPostParam('img',array());
		if(empty($links) || $id==0) jsonReturn(0,'修改失败');
		$linksDao = new DaoLinks();
		$links['title'] = trim($links['title']);
		$links['url'] = trim($links['url']);
		$links['sortID'] = ($links['sortID']); 
		$links['src'] = $images[0];
		$linksDao->update(" id = '$id'",$links);
		jsonReturn(1,'ok');
	}
}
?>
